﻿<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="NewsLetter.ascx.cs"
  Inherits="NguyenHoa.Web.Controls.NewsLetter" %>
<%@ Register Assembly="DevExpress.Web.v9.1, Version=9.1.4.0, Culture=neutral, PublicKeyToken=5377c8e3b72b4073"
  Namespace="DevExpress.Web.ASPxCallback" TagPrefix="dxcb" %>
<div class="box_w200">
  <div class="title_box_w200">
    <div class="bg_right">
      <div class="bg_mid">
        <div class="img_icon">
          <img src="../images/icon_info.png" alt="" width="45" height="35" />
        </div>
        <div class="title_name">
          <%=GetGlobalResourceObject("Strings", "RegistryNewsletter") %>
        </div>
      </div>
    </div>
  </div>
  <div class="content_box_w200">
    <div class="box_info">
      <p>
        <%=GetGlobalResourceObject("Strings", "NewsLetterIntroduction")%>
      </p>
      <div class="box_inputtext">
        <asp:TextBox ID="txtEmail" runat="server"></asp:TextBox>
        <a class="btn" onclick="sendNewsLetterRegistery()"><span><strong>
          <%=GetGlobalResourceObject("Strings", "Send")%></strong></span></a>
      </div>
    </div>
  </div>
</div>
<dxcb:ASPxCallback ID="cbFooter" ClientInstanceName="cbFooter" runat="server" OnCallback="cbFooter_Callback">
  <ClientSideEvents CallbackComplete="function(s, e){cbFooter_CallbackComplete(s, e);}" />
</dxcb:ASPxCallback>

<script language="javascript" type="text/javascript">
  function sendNewsLetterRegistery() {
    var email = document.getElementById('<%=txtEmail.ClientID %>').value;
    if (email == '') {
      alert('<%=(string)GetGlobalResourceObject("Messages","ERR0028") %>');
      return;
    }
    if (!ValidateEmail(email)) {
      alert('<%=(string)GetGlobalResourceObject("Messages","ERR0029") %>');
      return;
    }
    cbFooter.PerformCallback('NewsLetterRegistery');
  }

  function cbFooter_CallbackComplete(s, e) {
    var error = e.result;
    if (error != '') {
      alert(error);
    }
    else {
      alert('<%=(string)GetGlobalResourceObject("Messages", "ERR0092") %>');
      document.getElementById('<%=txtEmail.ClientID %>').value = '';
    }
  }
</script>

